package com.iworkh.spring.web.mvc.conversions;

import com.iworkh.spring.web.mvc.domain.vo.Student;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 自定义类型转化器
 *
 * @author: iworkh-沐雨云楼
 * @date: 2019-12-31
 */

@Component
public class IworkhStudentConverter implements Converter<String, Student> {
    @Override
    public Student convert(String s) {
        System.out.println("IworkhStudentConverter..." + s);
        Student student = new Student();
        student.setName("iworkh-default");
        student.setAge(29);
        student.setMoney(2200);
        student.setPhone("13862737362");
        student.setBirthday(new Date());

        return student;
    }
}
